package com.sskj.tibi.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.tibi.http.HttpConfig;
import com.sskj.tibi.ui.activity.AddAddressActivity;


public class AddAddressActivityPresenter extends BasePresenter<AddAddressActivity> {

    public void addAddress(String type, String address, String notes) {
        httpService.addAddress(type, address, notes)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        HttpData httpData = response.body();
                        ToastUtil.showShort(httpData.getMsg());
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.addSuccess();
                        }
                    }
                });
    }
}
